#include<iostream>
using  namespace  std;

typedef  struct  BiNode
{                                
        char  data;                                                  
        struct  BiNode  *lchild,*rchild;          
}BiTNode,*BiTree;
  
void  CreateBiTree(BiTree  &T)
{        
          
        char  ch;
        cin  >>  ch;
        if(ch=='#')    T=NULL;                          
        else{                                                        
                T=new  BiTNode;
                T->data=ch;                                          
                CreateBiTree(T->lchild);          
                CreateBiTree(T->rchild);          
        }                                                                  
}        
                                                                  
void Copy(BiTree T,BiTree &new_tree){
  if(T){
//    cout << T->data;
    new_tree = new BiTNode;
    new_tree = T;

    Copy(T->lchild,new_tree->lchild);
    Copy(T->rchild,new_tree->rchild);
  }
}

void  PostOrderTraverse(BiTree  &T)
{
  if(T){
    PostOrderTraverse(T->lchild);
    PostOrderTraverse(T->rchild);
    cout << T->data;
  }
}



int  main()
{
        BiTree  tree,new_tree;
        CreateBiTree(tree);
        Copy(tree,new_tree);
        PostOrderTraverse(new_tree);
        cout<<endl;
}

